<?php
return array(
	
	'attributeLabels' => array(
		'register_code' => '工商注册码',
		'desc' => '公司简介'
	),
	'relations' => array(
		'category' => array(ActiveRecord::BELONGS_TO, 'GoodsCategory', 'category_id'),
	),

	'rules' => array(
		array('name,address,category_id','required'),
		array(
			'business_license', 'file',
			'allowEmpty' => true,
			'types'=>'jpg, gif, png',
			'maxSize'=>1024*1024*500,
			'tooLarge'=>'上传文件超过500KB，无法上传。'
		),
		array('name', 'length', 'max'=>20),
		array('address', 'length', 'max'=>255),
		array('legal_representative', 'length', 'max'=>10),
		array('email','email','allowEmpty'=>true,'message'=>'邮箱格式不正确'),
		PregRules::telephoneRules('tel'),
		PregRules::telephoneRules('fax'),
		array('register_code,business_license','required'),
	),

	'behaviors' => array(
		'fileSaver' => array(
			'class' => 'lib.behaviors.ar.CFileSaveBehavior',
			'baseUrl' => Yii::app()->baseUrl . '/uploaded',
			'basePath' => dirname(Yii::app()->basePath) . '/uploaded',
			'attributes' => array('business_license'),
		),
		'fornt' => array(
			'class' => 'coms.behaviors.FrontBehavior',
			'attributes' => array(
				'desc' => 'desc',
				'img' => 'business_license'
			),
		),
	),


	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);